<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>我的微博列表</h1>
<table border="1">
    <tr>
        <th>id</th><th>微博内容</th><th>发布时间</th><th>操作</th>
    </tr>
    <tr v-for="weibo in arr">
        <td>{{weibo.id}}</td>
        <td>{{weibo.content}}</td>
        <td>{{weibo.created}}</td>
        <td><a href="#" @click="del(weibo.id)">删除</a></td>
    </tr>

</table>
<!--引入axios框架-->
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<!--引入VUE框架-->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
    let v = new Vue({
        el:"table",
        data:{
            arr:[]
        },
        created:function () {
            //请求自己的微博数据
            axios.get("/selectmyweibo").then(function (response) {
                v.arr = response.data;
            })
        },
        methods:{
            del:function(id){
                if(!confirm("您确认删除吗")){
                    return;
                }
                axios.get("/delete?id="+id).then(function (response) {
                    alert("删除完成！");
                    location.reload();
                })
            }

        }
    })
</script>

</body>
</html>